import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

import {menus} from "@/utils/menus"
const routes = [
  {path: '/',redirect:"/login"},
  {path: '/login',name: 'login',component: () => import('@/views/Login.vue')},
  {path: '/index',
    name: 'index',
    component: () => import('@/views/Index.vue'),
    redirect:"/index/ind",
    children:[
      ...menus
    ]
  },
  {path: '404',name: 'notFound',component: () => import('@/views/errorPage/404.vue')},
  {path: '*',redirect:{name:"notFound"}}

]




const router = new VueRouter({
  mode: 'hash',
  base: "",
  routes
})

const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

export default router




